<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>计算一个数的阶乘尾数多少个零</title>
</head>
<body>
  <script>
    function fn(n) {
      let num = 0
      // 乘到5才有1个0
      while(n >= 5) {
        // Math.floor 向下取整，例如：Math.floor(1.1) = 1
        // 因为乘到5才有1个0，所以除5
        n = Math.floor(n / 5)
        num += n
      }
      return num
    }
    console.log(fn(3));
  </script>
</body>
</html>